﻿using System;
using System.Collections.Generic;
using System.Linq.Expressions;

namespace Auth.Interface
{
    public interface IRepository<T> where T : class
    {
        int Add(T entity);
        int Add(T[] entities);

        int Delete(T entity);
        int Delete(Expression<Func<T, bool>> exp);

        int Update(T entity);
        int Update(Expression<Func<T, object>> identityExp, T entity);
        int Update(Expression<Func<T, bool>> where, Expression<Func<T, T>> entity);

        T Single(Expression<Func<T, bool>> exp);
        List<T> Find(Expression<Func<T, bool>> exp);
        List<T> Find(int pageIndex = 1, int pageSize = 10, string orderBy = "", Expression<Func<T, bool>> exp = null);

        bool IsExists(Expression<Func<T, bool>> exp);
        int GetCount(Expression<Func<T, bool>> exp = null);

        int Save();
    }
}
